<template>
	<div>

		<el-row>
			<el-col :span="8">
				<el-input placeholder="请输入患者"></el-input>
				<!-- @tab-click="handleClick" -->
				<el-tabs v-model="activeName" type="card">
					<el-tab-pane label="本人" name="first">

						<!-- 患者列表 -->
						<RegistList :type="1" @changeRegister="changeRegister"></RegistList>
					</el-tab-pane>
					<el-tab-pane label="科室" name="second">

						<!-- 患者列表 -->
						<RegistList :type="2" @changeRegister="changeRegister"></RegistList>
					</el-tab-pane>

				</el-tabs>


			</el-col>
			<el-col :span="16">
				<div>患者信息:{{register.name}}</div>


				<el-tabs v-model="rightActiveName" type="card">
					<el-tab-pane label="检查" name="check">
						<!-- 检查  created  ,id的属性发生变化，想要重新创建一次 check组件  ，  key：只要发生变化就触发组件的create -->
						<check :id="register.id"  :key="checkK"></check>
					</el-tab-pane>
					<el-tab-pane label="检验" name="inspect">

						检验
					</el-tab-pane>

				</el-tabs>




			</el-col>

		</el-row>



	</div>
</template>

<script>
	//
	import RegistList from './regist_list.vue'
	import check from './check.vue'
	export default {
		name: 'DoctorHome',
		components: {
			RegistList,
			check
		},
		data() {
			return {
				activeName: 'first',
				rightActiveName: 'check',
				register: {},
				checkK:"init"
						
			}
		},
		methods: {
			//监听左侧患者的切换
			changeRegister(register) {
				this.register = register;
				this.checkK = "checkK:"+Math.random();
				console.log("this.checkK: "+this.checkK)
			}
		}
	}
</script>

<style>
</style>
